/*
 * @Description: 环境数据
 */
import zhreq from "@/api/axios";
// import zhreqtwo from "@/api/axios";
export default {
  /**
   * @description: 获取环境数据详细信息 --- 地块组
   * @return {Array}
   */
  getdataitemlistone(facilityGroupId) {
    return zhreq.get(`v3/iot/device/queryLastDataByFacilityGroupNo?facilityGroupNo=${facilityGroupId}&organization=${sessionStorage.organizationNo}`)
  },
  // TODO:获取环境数据详细信息 --- 地块
  getdataitemlisttwo(facilityId) {
    return zhreq.get(`v3/iot/device/queryLastDataByFacilityNo?facilityNo=${facilityId}&organization=${sessionStorage.organizationNo}`)
  },
  //     return zhreq.post(`v3/iot/dataItem/queryLastDataByFacilityNo`,{"facilityNo":facilityId})
  /**
   * @description: 获取datatype位置和图片
   * @return {Array}
   */
  getdatatypelisttwo(datatypeid) {
    return zhreq.post('/dataTypeConfig/queryByCondition', {
      "less": "gl",
      "dataTypeId": datatypeid,
      "organizationNo": sessionStorage.getItem("parentId") || sessionStorage.getItem("organizationNo")
    })
  },
  //  通过设施id获取数据项
  getdataidechart(param) {
    return zhreq.post('/v3/iot/dataItem/queryByCondition', {
      "visible": true,
      // "category": "normal",
      ...param,
      "organizationNo": sessionStorage.getItem("organizationNo")

    })
  },
  /**
   * @description: 获取折线图数据
   * @return {Array}
   */
  getzhexiandataleft(params) {
    return zhreq.post('v3/iot/dataItem/queryHistory', {
      ...params,
      "organizationNo": sessionStorage.getItem("organizationNo")
    })
  },
  // 获取批次whw
  queryconditionbatch(id) {
    return zhreq.post('v3/batch/productionBatch/queryByCondition', {
      "facilityNo": id,
      "status": 0,
      "organizationNo": sessionStorage.getItem("organizationNo")
    })
  },
  // 获取当前批次的生长阶段whw
  getphasemethod(batchNo) {
    return zhreq.get(`v3/batch/productionBatch/getPhaseByNo?no=${batchNo}&organizationNo=${sessionStorage.organizationNo}`)
  },
  /**
   * @description: 获取种植品种
   * @return {Array}
   */
  queryconditionvarity(id) {
    return zhreq.post('/batch/queryByCondition', {
      "plantVarietyId": id,
      "status": false,
      "organizationNo": sessionStorage.getItem("organizationNo")
    })
  },
  ownFarmingTypelist(params) {
    return zhreq.post('v3/organization/organizationFarmingTypeMapper/queryByCondition', params)
  },
  // TODO:2023/7/5
  // 查询物联数据
  queryItem() {
    return zhreq.post('/v3/iot/dataTypeConfig/queryByCondition', {
        organizationNo: sessionStorage.getItem('organizationNo')
    })
  },
  // 图片导出任务
  task(params) {
    return zhreq.post('/v3/growth/collectRecord/task', params)
  },
  // 查询图片导出任务状态
  taskStatus() {
    return zhreq.get('/v3/growth/collectRecord/task/status')
  },
  // 查询图片下载
  taskDownload(taskId) {
    return zhreq.get(`/v3/growth/collectRecord/download?taskId=${taskId}`)
  },
}
